main() {
  Student s1 = new Student('刘子铭', 18, '1218');

  s1.sing();
  s1.dance();
  s1.rap();
  s1.basktball();
  s1.code();
  s1.debug();
  s1.study();
  s1.sayHello();
}

class Person {
  String name;
  int age;
  Person(this.name, this.age);

  void sayHello() {
    print('你好，我是$name，我今年$age岁');
  }
}

//with混合内  方法同名后面会覆盖前面
class Student extends Person with Skill, Coder {
  String id;
  Student(super.name, super.age, this.id);

  void study() {
    print('会学习');
  }
}

//定义混入
mixin Skill {
  void sing() {
    print('会唱歌');
  }

  void dance() {
    print('会跳舞');
  }

  void rap() {
    print('会rap');
  }

  void basktball() {
    print('会打篮球');
  }
}

mixin Coder {
  void code() {
    print('会写代码');
  }

  void debug() {
    print('会调试代码');
  }
}
